package com.study.spmongodb.study.spring.domain;


import org.springframework.beans.BeanUtils;

/**
 * @author MI
 * @version 1.0
 * @date 2020/11/12 14:35
 */
public class User {
    private String name;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    static {
        System.out.println("静态代码");
    }

    {
        System.out.println("代码块");
    }

    public User() {
        System.out.println("构造方法");
    }

    public void addUser() {
        System.out.println("add……");
    }

    @Override
    public String toString() {
        return "User{" +
                "name='" + name + '\'' +
                '}';
    }

    public static void main(String[] args) {
        final User user = new User();
        user.setName("name1");

        final User user1 = new User();
        BeanUtils.copyProperties(user, user1);
        user1.setName("bane2");
        System.out.println(user);
    }
}
